import React, { Component } from 'react'
import { Select, Form, Card, Button, Row, Col, Table, Divider, Tag, Input, DatePicker, Pagination, Upload, } from 'antd';
const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
import BaseComponent from '@/components/BaseComponent';
import { connect } from 'dva';
const { Option } = Select;

@connect(({ user }) => ({
    // data: risk.riskData,
    currentUser: user.currentUser,
}))
class index extends BaseComponent {
    constructor(props) {
        super(props)
        this.state = {
            // 是否正在上传附件
            uploadLoading: false,
            blReportFileUrl: ''
        }
    }

    componentDidMount() {

    }

    handleSubmit = e => {
        e.preventDefault();
        this.props.form.validateFields((err, values) => {
            if (!err) {
                console.log('Received values of form: ', values);
            }
        });
    };

    handleSelectChange = value => {
        console.log(value);
        this.props.form.setFieldsValue({
          note: `Hi, ${value === 'male' ? 'man' : 'lady'}!`,
        });
      };

    render() {

        const { getFieldDecorator } = this.props.form;
   
        return (
            <div>
                <Form labelCol={{ span: 5 }} wrapperCol={{ span: 12 }} onSubmit={this.handleSubmit}>
                    <Form.Item label="Note">
                        {getFieldDecorator('note', {
                            rules: [{ required: true, message: 'Please input your note!' }],initialValue: '初始值',
                        })(<Input />)}
                    </Form.Item>
                    <Form.Item label="Gender">
                        {getFieldDecorator('gender', {
                            rules: [{ required: true, message: 'Please select your gender!' }],
                        })(
                            <Select  
                                placeholder="Select a option and change input text above"
                                onChange={this.handleSelectChange}
                            >
                                <Option value="male">male</Option>
                                <Option value="female">female</Option>
                            </Select>,
                        )}
                    </Form.Item>
                    <Form.Item wrapperCol={{ span: 12, offset: 5 }}>
                        <Button type="primary" htmlType="submit">
                            Submit
                        </Button>
                    </Form.Item>
                </Form>


            </div>
        )
    }

}
const WrappedMyForm = Form.create()(index);

export default WrappedMyForm;